﻿using KingerRobot.MexicoSailunMDC.Dao;

namespace KingerRobot.MexicoSailunMDC.SpiService;
public class ScannerImpl : IScannerService
{
    private readonly static ILogScanner _LogScanner = new BLogScanner();
    private readonly static IWcsScanner _WcsScanner = new BWcsScanner();
    private readonly static IWcsScannerExecute _WcsScannerExecute = new BWcsScannerExecute();
    private readonly IWcsOutScannerAfter _WcsOutScannerAfter = new BWcsOutScannerAfter();
    private readonly static object _Lock = new object();


    public int AddWcsScanner(long scannerLocId, string productCode, int scannerCount, string remark, int priority)
    {
        var result = 0;
        lock (_Lock)
        {
            result = _WcsScanner.AddWcsScanner(scannerLocId, productCode, scannerCount, remark, priority);
        }
        return result;
    }
 

    public int AddWcsOutScannerAfter(long scannerLocId, string productCode)
    {
        var result = 0;
        lock (_Lock)
        {
            result = _WcsOutScannerAfter.AddWcsOutScannerAfter(scannerLocId, productCode);
        }
        return result;

    }



    public int InsertWcsScannerAbnormal(long locId, string remark, string productCode)
    {
        return _WcsScanner.InsertWcsScannerAbnormal(locId, remark, productCode);
    }

}
